<?php
/**
 * 视图基类
 */
class View
{
    protected $_controller;
    protected $_action;

    function __construct($controller, $action)
    {
        $this->_controller = strtolower($controller);
        $this->_action = strtolower($action);
    }

	 // 渲染显示
    public function render($view_name = '',$param = array())
    {
    	$layout_view = !empty($view_name)?$view_name:$this->_action;
		
        extract($param); //对于数组中的每个元素，键名用于变量名，键值用于变量值。 
        $controllerLayout = APP_PATH . 'application/views/' . $this->_controller . '/' . $layout_view . '.php';		
		if(file_exists($controllerLayout))
		{
			include($controllerLayout);		
		}	
    }
} 
 
